﻿<local:DocumentBase x:Class="WPFExcelReport.MVTVKEK"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          xmlns:local="clr-namespace:ReflectionStudio.Components.UserControls;assembly=ReflectionStudio.Core"
                xmlns:fd="clr-namespace:Labs.Filtering;assembly=ReflectionStudio.Core"
        xmlns:wep="clr-namespace:WPFExcelReport"
        xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"
       Height="700" Width="1024" 
       Background="White" 
         Loaded="Window_Loaded"
        Title="MVTVKEK"  
     >
    <local:DocumentBase.Resources>
        <ucd:DD2ColorConverter  x:Key="dd2color"/>
    </local:DocumentBase.Resources>
    <Grid DataContext="{Binding}">
        <Grid.RowDefinitions>
            <RowDefinition Height="100" />
            <RowDefinition Height="150*" />
            <RowDefinition Height="200*" />
            <RowDefinition Height="50*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="100*"></ColumnDefinition>
            <ColumnDefinition Width="100*"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <StackPanel Grid.ColumnSpan="2" Orientation="Vertical" Margin="0,0,0,65">
            <WrapPanel Width="1023" Height="38">
                <Label Content="客户简称："    Width="82" Margin="10,0,0,0"  HorizontalAlignment="Left"   FontSize="18" VerticalAlignment="Center" Foreground="#FF141111" />
                <TextBox Name="txtKUNDNR" Width="120" Margin="10,0,0,0"  HorizontalAlignment="Left" Panel.ZIndex="0"
                         KeyUp="txtART_KeyUp" Focusable="True" CharacterCasing="Upper" Background="Pink" MaxLength="10" FontSize="18" Foreground="#FF141111" Height="33" />
                <Label Content="建单人："    Width="66" Margin="10,0,0,0"  HorizontalAlignment="Left"   FontSize="18" VerticalAlignment="Center" Foreground="#FF141111" />
                <TextBox Name="txtNEUBEN" Width="94" Margin="10,0,0,0"  HorizontalAlignment="Left" Panel.ZIndex="1"
                         KeyUp="txtART_KeyUp" Focusable="True" CharacterCasing="Upper" Background="Azure" MaxLength="8" FontSize="18" Foreground="#FF141111" Height="33" />
                <Label Content="客户负责人："    Width="103" Margin="10,0,0,0"  HorizontalAlignment="Left"   FontSize="18" VerticalAlignment="Center" Foreground="#FF141111" />
                <TextBox Name="txtSACHBE" Width="96" Margin="10,0,0,0"  HorizontalAlignment="Left" Panel.ZIndex="2"
                         KeyUp="txtART_KeyUp" Focusable="True" CharacterCasing="Upper" Background="AntiqueWhite" MaxLength="8" FontSize="18" Foreground="#FF141111" Height="33" />
                <Label Content="PI#："    Width="38" Margin="10,0,0,0"  HorizontalAlignment="Left"   FontSize="18" VerticalAlignment="Center" Foreground="#FF141111" />
                <TextBox Name="txtPI" Width="157" Margin="10,0,0,0"  HorizontalAlignment="Left" Panel.ZIndex="3"
                         KeyUp="txtART_KeyUp" Focusable="True" CharacterCasing="Upper" Background="Beige" MaxLength="20" FontSize="18" Foreground="#FF141111" Height="33" />
            </WrapPanel>
        </StackPanel>
        <StackPanel Grid.ColumnSpan="2" Orientation="Vertical" Margin="0,37,0,28">
            <WrapPanel Width="1023">
                <Label Content="品种编号："    Width="74" Margin="10,0,0,0"  HorizontalAlignment="Left"   FontSize="16" VerticalAlignment="Center" Foreground="#FF141111" />
                <TextBox Name="txtARTICLE" Width="163" Margin="10,0,0,0"  HorizontalAlignment="Left" CharacterCasing="Upper" Panel.ZIndex="4"
                         KeyUp="txtART_KeyUp" Background="Aquamarine" MaxLength="12" FontSize="16" Foreground="#FF141111" Height="33" />
                <Label Content="销售交期从" Height="26" HorizontalAlignment="Left" Margin="10,5,0,0" Name="label1" VerticalAlignment="Top" Width="87" FontSize="16" />
                <DatePicker Height="25" HorizontalAlignment="Left" Margin="0,2,0,0" Name="FROM_SHIPPING_DATE" VerticalAlignment="Top" 
                                SelectedDateChanged ="FROM_SHIPPING_DATE_SelectedDateChanged" Width="111" />
                <Label Content="至" Height="28" HorizontalAlignment="Left" Margin="10,5,0,0" Name="label2" VerticalAlignment="Top" Width="19" FontSize="16" />
                <DatePicker Height="25" HorizontalAlignment="Left" Margin="0,2,0,0" Name="END_SHIPPING_DATE" VerticalAlignment="Top" 
                                SelectedDateChanged ="END_SHIPPING_DATE_SelectedDateChanged" Width="113" />
                <Label Content="供应商简称："    Width="94" Margin="10,0,0,0"  HorizontalAlignment="Left"   FontSize="16" VerticalAlignment="Center" Foreground="#FF141111" />
                <TextBox Name="txtSUP" Width="115" Margin="10,0,0,0"  HorizontalAlignment="Left" Background="Pink" Panel.ZIndex="5"
                         KeyUp="txtART_KeyUp" CharacterCasing="Upper" MaxLength="10" FontSize="16" Foreground="#FF141111" Height="33" />

            </WrapPanel>
        </StackPanel>
        <StackPanel Margin="0,72,0,0" Grid.RowSpan="4" Grid.ColumnSpan="2">
            <WrapPanel >
                <Label Content="采购交期从" Height="26" HorizontalAlignment="Left" Margin="10,5,0,0" Name="label3" VerticalAlignment="Top" Width="87" FontSize="16" />
                <DatePicker Height="25" HorizontalAlignment="Left" Margin="0,2,0,0" Name="FROM_DN_DATE" VerticalAlignment="Top" 
                                SelectedDateChanged ="FROM_DN_DATE_SelectedDateChanged" Width="113" />
                <Label Content="至" Height="28" HorizontalAlignment="Left" Margin="10,5,0,0" Name="label4" VerticalAlignment="Top" Width="19" FontSize="16" />
                <DatePicker Height="25" HorizontalAlignment="Left" Margin="0,2,0,0" Name="END_DN_DATE" VerticalAlignment="Top" 
                                SelectedDateChanged ="END_DN_DATE_SelectedDateChanged" Width="112" />
                <Label Content="下采购单从" Height="26" HorizontalAlignment="Left" Margin="10,5,0,0" Name="label5" VerticalAlignment="Top" Width="87" FontSize="16" />
                <DatePicker Height="25" HorizontalAlignment="Left" Margin="0,2,0,0" Name="FROM_EK_DATE" VerticalAlignment="Top" 
                                SelectedDateChanged ="FROM_EK_DATE_SelectedDateChanged" Width="113" />
                <Label Content="至" Height="28" HorizontalAlignment="Left" Margin="10,5,0,0" Name="label6" VerticalAlignment="Top" Width="19" FontSize="16" />
                <DatePicker Height="25" HorizontalAlignment="Left" Margin="0,2,0,0" Name="END_EK_DATE" VerticalAlignment="Top" 
                                SelectedDateChanged ="END_EK_DATE_SelectedDateChanged" Width="112" />
                <Button Content="查询数据" Height="33" Margin="10,0,0,0"  Name="btnQuery" Width="73" Panel.ZIndex="8"
                        Click="btnQuery_Click"/>
                <Button Content="导出EXCEL" Height="33" Margin="10,0,0,0"  Name="btnEXCEL" Width="73" Panel.ZIndex="9"
                        Click="btnEXCEL_Click"/>
            </WrapPanel>
            <WrapPanel>
                <DataGrid CanUserReorderColumns="True" 
                          CanUserResizeRows="True" CanUserSortColumns="True"
                          AutoGenerateColumns="False"   
                  EnableRowVirtualization="True"  
                  Width="1000"
                  Height="600"
                  EnableColumnVirtualization="True"  
                  ScrollViewer.HorizontalScrollBarVisibility="Auto"
                  ScrollViewer.VerticalScrollBarVisibility="Auto"
                  RowDetailsVisibilityMode="VisibleWhenSelected" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                                IsSynchronizedWithCurrentItem="True" Opacity="10" Visibility="Visible"
                               ItemsSource="{Binding}" x:Name="MasterDg" 
                               Grid.ColumnSpan="2" Margin="0,10,0,0" Grid.RowSpan="3" Grid.Row="1" DataContext="{Binding}">                    
                    <DataGrid.Columns>
                        <DataGridTemplateColumn Header="剩余天数">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <StackPanel Background="{Binding DD, Converter={StaticResource dd2color}}">
                                        <TextBlock Text="{Binding Path=DD}"/>
                                    </StackPanel>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                        <DataGridTextColumn Binding="{Binding Path=KUNDNR}" Header="客户" Width="SizeToCells" MinWidth="40" />
                        <DataGridTextColumn Binding="{Binding Path=PI}" Header="PI#" Width="SizeToCells" MinWidth="50" />
                        <DataGridTextColumn Binding="{Binding Path=VKPAUFPOS}" Header="行" Width="SizeToCells" MinWidth="30" />
                        <DataGridTextColumn Binding="{Binding Path=VKPKDKOMM}" Header="客户PO" Width="SizeToCells" MinWidth="40" />
                        <DataGridTextColumn Binding="{Binding Path=VKPPOSTYP}" Header="订单类型" Width="SizeToCells" MinWidth="30" />
                        <DataGridTextColumn Binding="{Binding Path=VKPART}" Header="品种" Width="SizeToCells" MinWidth="40" />
                        <DataGridTextColumn Binding="{Binding Path=VKPFARBE}" Header="颜色" Width="SizeToCells" MinWidth="40" />
                        <DataGridTextColumn Binding="{Binding Path=VKQTY}" Header="销售数量" Width="SizeToCells" MinWidth="40" />
                        <DataGridTextColumn Binding="{Binding Path=VKPMEEH}" Header="单位" Width="SizeToCells" MinWidth="30" />
                        <DataGridTextColumn Binding="{Binding Path=VKPLIEFTERM}" Header="销售交期" Width="SizeToCells" MinWidth="50" />
                        <DataGridTextColumn Binding="{Binding Path=VKPNEUDAT}" Header="销售下单日期" Width="SizeToCells" MinWidth="50" />
                        <DataGridTextColumn Binding="{Binding Path=LSLIEFNA}" Header="供应商" Width="SizeToCells" MinWidth="40"/>
                        <DataGridTextColumn Binding="{Binding Path=EKPLSART}" Header="供应商品种" Width="SizeToCells" MinWidth="50" />
                        <DataGridTextColumn Binding="{Binding Path=EKPLSFB}" Header="颜色" Width="SizeToCells" MinWidth="40" />
                        <DataGridTextColumn Binding="{Binding Path=EKQTY}" Header="采购数量" Width="SizeToCells" MinWidth="40" />
                        <DataGridTextColumn Binding="{Binding Path=EKPMEEH}" Header="单位" Width="SizeToCells" MinWidth="30" />
                        <DataGridTextColumn Binding="{Binding Path=EKPWUTERM}" Header="寄样日期" Width="SizeToCells" MinWidth="40" />
                        <DataGridTextColumn Binding="{Binding Path=EKPLTERM}" Header="采购交期" Width="SizeToCells" MinWidth="50" />
                        <DataGridTextColumn Binding="{Binding Path=EKPNEUD}" Header="下采购日期" Width="SizeToCells" MinWidth="50" />
                        <DataGridTextColumn Binding="{Binding Path=VKKNEUBEN}" Header="开单人" Width="SizeToCells" MinWidth="40" />
                        <DataGridTextColumn Binding="{Binding Path=VKKSACHBE}" Header="负责人" Width="SizeToCells" MinWidth="40" />
                        <DataGridTextColumn Binding="{Binding Path=VKKANSPZUS}" Header="最终客户" Width="SizeToCells" MinWidth="40" />
                        <!--DataGridTextColumn Binding="{Binding Path=DD}" Header="剩余天数" Width="SizeToCells" MinWidth="40" /-->
                     
                    </DataGrid.Columns>
                </DataGrid>
            </WrapPanel>
        </StackPanel>
    </Grid>
</local:DocumentBase>
